<?php


namespace app\common\validate;


use think\Validate;

class Vld_system  extends Validate //验证 管理员规则
{
    //验证规则 文章
    protected $rule=[
        'state|状态'=>'require',
        'interval_cpu|CPU间隔'=>'require|number',
        'interval_mem|内存间隔'=>'require|number',
        'interval_pid1|进程间隔'=>'require|number',
        'id|编号'=>'require|number',
    ];
    protected $message  =   [
        'state.require' => '状态不能为空！',       
        'interval_cpu.require' => 'CPU间隔必填！',
        'interval_cpu.number'     => 'CPU间隔为纯数字！',
        'interval_mem.require' => '内存间隔必填！',
        'interval_mem.number'     => '内存间隔为纯数字！',
        'interval_pid1.require' => '进程间隔必填！',
        'interval_pid1.number'     => '进程间隔为纯数字！',
        'id.require'   => '编号不能为空！',
        'id.number'   => '编号为纯数字！',
    ];
    //验证场景

    protected  $scene=[
        //'add'=>['name','tel','tags','fst_id'],
        'edit'=>['state','id','interval_cpu','interval_mem','interval_pid1'],
    ];

    public function sceneDel()
    {   // del 验证方法
        return $this->only(['id']); //过滤不需要的unique规则;
    }
}
